using System;

namespace InheritanceExample // 命名空间
{
    public class Animal // 基类
    {
        public string Name { get; set; }

        // 基类构造函数
        public Animal(string name)
        {
            Name = name;
            Console.WriteLine($"Animal created: {Name}");
        }
    }

    public class Dog : Animal // 派生类
    {
        public string Breed { get; set; }

        // 派生类构造函数，调用基类构造函数
        public Dog(string name, string breed) : base(name) // base(name) 调用基类构造函数
        {
            Breed = breed;
            Console.WriteLine($"Dog created: {Name}, Breed: {Breed}");
        }
    }

    public class Program
    {
        public static void Main(string[] args)
        {
            Dog myDog = new Dog("Buddy", "Golden Retriever");
            // 输出:
            // Animal created: Buddy
            // Dog created: Buddy, Breed: Golden Retriever
        }
    }
}
